import { currentUserID } from "@/utils/common.js";
import { utils } from 'hi-ui';
//其他出入库数据集配置
export default {
    id: "InStockDetailEntity",
    returnTotal: true,
    modelFile: "store/other/instock/dataset/InStockDetailEntity.xml",
    //主从配置
    relation: {
        selfField: ["FNUMBER"],
        parentField: ["FNUMBER"]
    },
    sortFields: [
        "FID",
        "FNUMBER",
        "FGOODSNUMBER",
        "FBARCODE",
        "FDESC",
        "FAMOUNT",
        "FUNIT",
        "FPRICE",
        "FMONEY",
        "FPRICE",
        "FRETAILMONEY",
        "FUSERID",
        "FCREATEDATE",
        "FBRAND",
        "FENTERPRISEDESC",
        "FENTERPRISEID",
        "FSHOPDESC",
        "FSHOPDESCID",
        "FSORT",
        "FSPEC"
    ],
    //字段元素
    element: {
        eleSort: {
            field: "FSORT",
        }
    },
    fields: {
        FID: {
            name: "FID", //字段ID
            label: "ID", //字段描述
            dbtype: "dbString", //数据类型
            default: {
                //默认值
                //rule: 'first', //prior   填充规则
                exps: (data) => {
                    //填充表达式
                    return utils.string.guid();
                },
            },
        },
        FNUMBER: {
            name: "FNUMBER", //字段ID
            label: "单号", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,
            required: true,
            length: 25,

        },
        FSORT: {
            name: "FSORT", //字段ID
            label: "排序", //字段描述
            dbtype: "dbInt", //数据类型

        },
        FUSERID: {
            name: "FUSERID", //字段ID
            label: "创建人", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,
            required: true,
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return currentUserID();
                },
            },
        },
        FCREATEDATE: {
            name: "FCREATEDATE", //字段ID
            label: "创建日期", //字段描述
            dbtype: "dbDate", //数据类型
            readonly: true,
            required: true,
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    return utils.date.format(new Date(), "yyyy-MM-dd HH:mm:ss");
                },
            },
        },
        FGOODSNUMBER: {
            name: "FGOODSNUMBER", //字段ID
            label: "店内编码", //字段描述
            dbtype: "dbString", //数据类型
            required: true,
            length: 25,
        },
        FBARCODE: {
            name: "FBARCODE", //字段ID
            label: "条形码", //字段描述
            dbtype: "dbString", //数据类型
            required: true,
            length: 25,
        },
        FDESC: {
            name: "FDESC	", //字段ID
            label: "通用名称 ", //字段描述
            dbtype: "dbString", //数据类型
            // readonly: true,
            required: true,
            length: 25,
        },
        FSPEC: {
            name: "FSPEC", //字段ID
            label: "规格", //字段描述
            dbtype: "dbString", //数据类型
            required: true,
            readonly: true,
            length: 100,
        },
        FUNIT: {
            name: "FUNIT", //字段ID
            label: "单位", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,
            required: true,
            // readonly: true,
            length: 25,
        },
        FKCAMOUNT: {
            name: "FKCAMOUNT", //字段ID
            label: "库存数量", //字段描述
            dbtype: "dbFloat", //数据类型

        },
        FAMOUNT: {
            name: "FAMOUNT", //字段ID
            label: "数量", //字段描述
            dbtype: "dbFloat", //数据类型
            required: true,
            fireTarget: ["FMONEY"]
        },

        FPRICE: {
            name: "FPRICE", //字段ID
            label: "单价", //字段描述
            dbtype: "dbFloat", //数据类型
            required: true,
            fireTarget: ["FMONEY"]
        },
        FMONEY: {
            name: "FMONEY", //字段ID
            label: "金额", //字段描述
            dbtype: "dbFloat", //数据类型
            required: true,
            readonly: true,
            default: {
                //默认值
                exps: (data) => {
                    //填充表达式
                    /*  if (data.FPRICE && data.FAMOUNT)
                         return data.FPRICE * data.FAMOUNT */
                    if (data.FPRICE && data.FAMOUNT)
                        return utils.number.accMul(data.FPRICE, data.FAMOUNT)
                },
            },
        },
        FBRAND: {
            name: "FBRAND", //字段ID
            label: "品牌", //字段描述
            dbtype: "dbString", //数据类型
            readonly: true,
            // required: true,       
        },
        FENTERPRISEDESC: {
            name: "FENTERPRISEDESC", //字段ID
            label: "企业名称", //字段描述
            dbtype: "dbString", //数据类型
            length: 25,
        },
        FENTERPRISEID: {
            name: "FENTERPRISEID", //字段ID
            label: "企业ID", //字段描述
            dbtype: "dbString", //数据类型
            length: 25,
        },
        FSHOPDESC: {
            name: "FSHOPDESC", //字段ID
            label: "店铺", //字段描述
            dbtype: "dbString", //数据类型
            required: true,
            length: 25,
        },
        FSHOPDESCID: {
            name: "FSHOPDESCID", //字段ID
            label: "店铺编号", //字段描述
            dbtype: "dbString", //数据类型
            required: true,
            length: 25,
        },

    },

}